using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class prcdicMap : EntityTypeConfiguration<prcdic>
    {
        public prcdicMap()
        {
            // Primary Key
            this.HasKey(t => new { t.constants, t.prc_cls_e, t.prc_cls_o, t.field_nm, t.table, t.index_fl, t.index });

            // Properties
            this.Property(t => t.constants)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.prc_cls_e)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.prc_cls_o)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(20);

            this.Property(t => t.field_nm)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.table)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.index_fl)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(10);

            this.Property(t => t.index)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            // Table & Column Mappings
            this.ToTable("prcdic");
            this.Property(t => t.constants).HasColumnName("constants");
            this.Property(t => t.prc_cls_e).HasColumnName("prc_cls_e");
            this.Property(t => t.prc_cls_o).HasColumnName("prc_cls_o");
            this.Property(t => t.field_nm).HasColumnName("field_nm");
            this.Property(t => t.table).HasColumnName("table");
            this.Property(t => t.index_fl).HasColumnName("index_fl");
            this.Property(t => t.index).HasColumnName("index");
        }
    }
}
